-- 使用 lazy.nvim 插件管理器配置 leetcode.nvim
local leet_arg = "leetcode.nvim"

return {
    "kawre/leetcode.nvim",
    build = ":TSUpdate html", -- 更新 HTML 解析器
    dependencies = {"nvim-telescope/telescope.nvim", -- telescope 所需
    "nvim-lua/plenary.nvim", -- telescope 所需
    "MunifTanjim/nui.nvim", -- 可选依赖
    "nvim-treesitter/nvim-treesitter", -- 用于格式化问题描述，确保安装
    "rcarriga/nvim-notify", "nvim-tree/nvim-web-devicons"},
    lazy = leet_arg ~= vim.fn.argv()[1], -- 确保只有在启动时加载
    opts = {
        arg = leet_arg,
        cn = {
            enabled = true -- 启用 leetcode.cn
        },
        lang = "python3", -- 默认语言设置为 C++
        logging = true, -- 启用日志记录
        storage = {
            home = vim.fn.stdpath("data") .. "/leetcode/"
        },
        cache = {
            update_interval = 60 * 60 * 24 * 7 -- 每 7 天更新缓存
        },
        console = {
            open_on_runcode = true,
            dir = "row", -- 控制台方向
            size = {
                width = "90%",
                height = "75%"
            },
            result = {
                size = "60%"
            },
            testcase = {
                virt_text = true,
                size = "40%"
            }
        },
        description = {
            position = "left", -- 题目描述的位置
            width = "40%", -- 题目描述宽度
            show_stats = true -- 显示统计信息
        },
        image_support = false -- 是否支持图片显示
    }
}

